package me.jzn.alib.utils;

import me.jzn.core.utils.StrUtil;

public class CommUriUtil {
    public static String buildMarketUri(String packageName) {
        return "market://details?id=" + packageName;
    }

    public static String buildQQUri(String qqNum) {
        //uin是发送过去的qq号码
        return "mqqwpa://im/chat?chat_type=wpa&uin=" + qqNum;
    }
    //https://qun.qq.com/join.html

    /****************
     *
     * 发起添加群流程。群号：安全密码本客服群(866216025) 的 key 为： 8tcKaglKjy7MltAmrmiwYsulQG1u0Aay
     * 调用 joinQQGroup(8tcKaglKjy7MltAmrmiwYsulQG1u0Aay) 即可发起手Q客户端申请加群 安全密码本客服群(866216025)
     *
     * @param qqGroupKey 由官网生成的key
     * @return 返回true表示呼起手Q成功，返回false表示呼起失败
     ******************/
    public static String buildQQGroupUri(String qqGroupKey) {
        return "mqqopensdkapi://bizAgent/qm/qr?url=http%3A%2F%2Fqm.qq.com%2Fcgi-bin%2Fqm%2Fqr%3Ffrom%3Dapp%26p%3Dandroid%26jump_from%3Dwebapi%26k%3D" + qqGroupKey;
    }

    public static String buildAliPayUri(String appId, String rawUrl) {
        String encodedUrl = StrUtil.urlEnc(rawUrl, StrUtil.UTF8);
        if (appId == null) {
            appId = "20000067";
        }
        return "alipays://platformapi/startapp?appId=" + appId + "&url=" + encodedUrl;
    }
}
